// 以下代码是配置layui扩展模块的目录，每个页面都需要引入
layui.config({
	version: true,
	// debug: true,
	base: window.location.protocol + '//' + window.location.host + '/'
}).extend({
	exconfig: 'common/module/exconfig',
	exutil: 'common/module/exutil',
	exrouter: 'common/module/exrouter',
	// API
	sysUser: 'apis/sysUser',
	sysMenu: 'apis/sysMenu'
}).use(['exutil', 'jquery', 'exconfig', 'exrouter'], function() {
	 var $ = layui.jquery,
		exutil = layui.exutil,
		exconfig = layui.exconfig,
		exrouter = layui.exrouter,
		pathname = window.location.pathname;

	if(pathname === "/"){
		exutil.showLoading('正在跳转中...')
		
		if(exutil.getCookie(exconfig.tokenKey)){
			setTimeout(function() {
				top.location.href = exrouter.base.home();
			}, 600);
		}else{
			setTimeout(function() {
				top.location.href = exrouter.base.login();
			}, 600);
		}
	}else if(pathname === "/modules/base/pages/home/home.html"){
		
		var index = exutil.showLoading('正在加载中...');
		setTimeout(function() {
			exutil.close(index);
			$(".wt-hide").removeClass('wt-hide');
		}, window == top ? 600 : 100);
	}

});
